<?php


namespace app\common\business;


use think\Exception;

class OrderGoods extends BusBase
{
    protected $model = null;

    public function __construct()
    {
        $this->model = new \app\common\model\mysql\OrderGoods();
    }

    public function saveAll($data)
    {
        try {
            $res = $this->model->saveAll($data);
        } catch (Exception $e) {
            return false;
        }
        return $res->toArray();
    }

    public function getByOrderId($order_id)
    {
        try {
            $orders = $this->model->getByCondition(['order_id' => $order_id]);
        } catch (Exception $e) {
            return [];
        }

        if (!$orders) {
            return [];
        }

        return $orders;
    }
}